/// @file TanContainer.h
#pragma once

#include <QPolygon>
#include <QPolygonF>
#include <QLinkedList>
#include <set>
#include <core/ContainerWidget.h>
#include "../core/CoordinateTransformer.h"

namespace qtangram {
class Tan;

/// @class TanContainter
/// @brief Generic container for Tans.
class TanContainer {
public:
    TanContainer();
    /// list of Tans currently in this container
    QLinkedList<Tan*> tans;
    /// currently selected tans
    QLinkedList<Tan*> selection;
    /// selection origin
    QPointF selectionOrigin;
    /// selection area
    QRectF selectionArea;
    void allTansCoordsTo(const ContainerWidget* widget);
    /// Clears the selection
    void deselectAllTans();
    /// Checks if pointed Tan is currently selected
    bool isSelected(Tan* t);
    /// Selects pointed Tan
    void selectTan(Tan* t);
    /// Selects the Tan located in given position
    int selectTanAt(QPointF p);
    /// Selects the Tan located in given position
    int selectTanAt(QPointF a, QPointF b);
    /// Looks for the Tan in given position
    /// @return Tan* Pointer to the found Tan or NULL
    Tan* findTanAt(QPointF p);
};
}
